package sk.naive.talker.command;

import sk.naive.talker.*;
import sk.naive.talker.message.*;

import java.rmi.RemoteException;

/**
 * Afk.
 *
 * @author <a href="mailto:virgo@naive.deepblue.sk">Richard "Virgo" Richter</a>
 * @version $Revision: 1.7 $ $Date: 2005/02/07 21:20:39 $
 */
public class Afk extends AbstractCommand {
	public void exec() throws CommandException, RemoteException {
		AfkHelper afkHelper = new AfkHelper(user);
		afkHelper.set(params);
		String myKey = "afk.set";
		String keyForOther = "afk.audience";
		if (params != null && params.length() > 0) {
			myKey = "afk.setReason";
			keyForOther = "afk.audienceReason";
			ctxSet(DefaultMessageFactory.CTXKEY_VAL, params);
		}
		sendHelper().sendLocal(user, myKey, keyForOther, Category.AFK);
	}
}
